﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HousingManagerSearch.aspx.cs"
    Inherits="ZLDC.Estate.PM.HousingManagerSearch" %>

<%@ Register Src="../UserControl/HousingMS_Auto.ascx" TagName="HousingMS_Auto" TagPrefix="uc1" %>
<%@ Register Src="../UserControl/Build_List.ascx" TagName="Build_List" TagPrefix="uc2" %>
<%@ Register Src="../UserControl/Dept_Tree.ascx" TagName="Dept_Tree" TagPrefix="uc3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>盘源查询条件</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

</head>
<body onclick="closeDiv()">
    <form id="form1" runat="server">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td bgcolor="#FFFFFF">
                <b>基本查询 &nbsp; &nbsp; &nbsp; &nbsp;<asp:RadioButton ID="rbUsageType1" GroupName="rbUsageType"
                    Text="住宅" onclick="return dataBind();" runat="server" Visible="false" />
                    &nbsp;<asp:RadioButton ID="rbUsageType2" GroupName="rbUsageType" Text="写字楼" runat="server"
                        onclick="return dataBind();" Visible="false" />
                    &nbsp;<asp:RadioButton ID="rbUsageType3" GroupName="rbUsageType" Text="商铺" runat="server"
                        onclick="return dataBind();" Visible="false" />
                    &nbsp;<asp:RadioButton ID="rbUsageType4" GroupName="rbUsageType" Text="厂房" runat="server"
                        onclick="return dataBind();" Visible="false" />
                    &nbsp;<asp:RadioButton ID="rbUsageType5" GroupName="rbUsageType" Text="民房" runat="server"
                        onclick="return dataBind();" Visible="false" />
                </b>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            楼盘名称:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <uc1:HousingMS_Auto ID="HousingMS_Auto1" runat="server" />
                        </td>
                        <%--<td height="25" align="right" bgcolor="#F7F7F7">
                            用途:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sUsage" name="sUsage" runat="server" style="width: 80px;">
                            </select>
                        </td>--%>
                        
                        <td bgcolor="#FFFFFF" align="right">
                            盘源编号:
                       </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iID" name="iID" type="text" style="width: 100px;" onkeyup="LexunJS.checkNum(this)" />
                        </td>
                        
                        
                        <td height="25" align="center" bgcolor="#FFFFFF" colspan="2">
                            钥匙<input id="cbHasKey" name="cbHasKey" type="checkbox" />&nbsp; 独家<input id="cbIsOnly"
                                name="cbIsOnly" type="checkbox" />&nbsp;反签<input id="cbIsCty"
                                name="cbIsOnly" type="checkbox" />&nbsp; 有图<input id="cbHasPhoto" name="cbHasPhoto"
                                    type="checkbox" />&nbsp; 红本<input id="cbPocStatus" name="cbPocStatus" type="checkbox" />&nbsp;
                            满5年免税<input id="cbMark2" name="cbMark2" type="checkbox" />
                        </td>
                    </tr>
                    <tr>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            栋阁:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF">
                            <uc2:Build_List ID="Build_List1" runat="server" />
                        </td>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            交易:
                        </td>
                        <td width="20%" bgcolor="#FFFFFF">
                            <select id="sTradeType" name="sTradeType" runat="server" style="width: 80px;" onchange="changeTradeType()">
                                <option value="0">全部</option>
                                <option value="1">出售</option>
                                <option value="2">出租</option>
                            </select>
                        </td>
                        <td width="10%" height="25" align="right" bgcolor="#F7F7F7">
                            状态:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF">
                            <select id="sStatus" name="sStatus" runat="server" style="width: 80px;">
                                <option value="1">当前盘</option>
                                <option value="0">全部</option>
                                <option value="2">资料盘</option>
                                <option value="3">无效盘</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            楼层:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iFloor1" name="iFloor1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iFloor2" name="iFloor2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            面积:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iAcreage1" name="iAcreage1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iAcreage2" name="iAcreage2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" /><font
                                color="red">m2</font>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            户型:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="sRoom" name="sRoom" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="sRoom1" name="sRoom1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            房
                            <select id="sHall" name="sHall" runat="server">
                                <option value="0">全部</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                            </select>厅
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td bgcolor="#FFFFFF" colspan="8">
                <b>高级查询</b>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
                    <tr>
                        <td width="10%" align="right" bgcolor="#F7F7F7">
                            价格:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF">
                            <input id="iPrice1" name="iPrice1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iPrice2" name="iPrice2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" /><font
                                color="red"><span id="spanTradeTypeUnit">万元</span></font>
                        </td>
                        <td width="10%" align="right" bgcolor="#F7F7F7">
                            朝向:
                        </td>
                        <td width="20%" bgcolor="#FFFFFF">
                            <select id="sDirect" name="sDirect" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td width="10%" align="right" bgcolor="#F7F7F7">
                            装修:
                        </td>
                        <td width="25%" bgcolor="#FFFFFF">
                            <select id="sFitment" name="sFitment" runat="server" style="width: 80px;">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            业主姓名:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iLinkMan" name="iLinkMan" type="text" style="width: 100px;" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            房号:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iRoomNo" name="iRoomNo" type="text" style="width: 100px;" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            样式:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sHouseStyle" name="sHouseStyle" runat="server" style="width: 80px;">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            业主电话:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iLinkTel" name="iLinkTel" type="text" style="width: 100px;" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            类型:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sType" name="sType" runat="server" style="width: 80px;">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            开盘人:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="usubclass" title='拼音首字母提示,格式:姓名[工号,部门]' style="width: 100px" name="umainclass"
                                onblur="selDU()" />
                            <input id="utxtsub" name="utxtsub" runat="server" style="display: none;" />
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            开盘人部门:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <uc3:Dept_Tree ID="Dept_Tree2" runat="server" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            房屋设施:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iHappliances" name="iHappliances" type="text" style="width: 80px;" />
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            委托日期:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iStartDay" name="iStartDay" onclick="WdatePicker()" style="width: 60px;" />
                            ~
                            <input id="iEndDay" name="iEndDay" onclick="WdatePicker()" style="width: 60px;" />
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            单价:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <input id="iUnitPrice1" name="iUnitPrice1" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            ~
                            <input id="iUnitPrice2" name="iUnitPrice2" type="text" style="width: 40px;" onkeyup="LexunJS.checkNum(this)" />
                            <font color="red">元/m2</font>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            城区:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sCity2" name="sCity2" runat="server" style="width: 80px;" onchange="return loadCity('sCity2', 'sCity3')">
                            </select>
                        </td>
                        <td height="25" align="right" bgcolor="#F7F7F7">
                            片区:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <select id="sCity3" name="sCity3" runat="server" style="width: 80px;">
                            </select>
                        </td>
                    </tr> 
                    <tr>
                         <td height="25" align="right" bgcolor="#F7F7F7">
                          
                         </td>
                         <td bgcolor="#FFFFFF" >
                         
                         </td>
                         <td height="25" align="right" bgcolor="#F7F7F7">
                          来源：
                         </td>
                         <td bgcolor="#FFFFFF" colspan="3">
                            <select id="infoFrom" runat="server" style="width: 120px;"  name="infoFrom">
                            <option></option>
                            </select>
                        </td>
                    </tr>                   
                </table>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="6">
                <br />
                <input id="btnSearch" class="button_bak" type="button" value="查询" onclick="return search()" />
                &nbsp;
                <input id="btnReset" class="button_bak" type="button" value="重置" onclick="return reset()" />
            </td>
        </tr>
    </table>
    <input id="hUsage" name="hUsage" value="" type="hidden" />
    </form>
</body>

<script src="../js/jquery.autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>

<script src="../js/jquery/jquery.simple.tree.js" type="text/javascript"></script>

<script src="../js/cm_customerchange.js" type="text/javascript"></script>

<script src="../js/LexunJS.js" type="text/javascript"></script>

<script type="text/javascript" language="javascript">
    // 条件查询
    function search() {
        var usage = "";  //LexunJS.GetSelectValue("sUsage");    // 用途 1住宅 2商铺 3写字楼 4商住 5仓库 6厂房 7地皮 8项目盘 9其他* 10民房
        if (usage == "") {
            if ($("#rbUsageType1").length > 0) {
                if (document.getElementById("rbUsageType1").checked == true)
                    usage = "1,4";
            }
            if ($("#rbUsageType2").length > 0) {
                if (document.getElementById("rbUsageType2").checked == true)
                    usage = "3,4";
            }
            if ($("#rbUsageType3").length > 0) {
                if (document.getElementById("rbUsageType3").checked == true)
                    usage = "2";
            }
            if ($("#rbUsageType4").length > 0) {
                if (document.getElementById("rbUsageType4").checked == true)
                    usage = "6";
            }
            if ($("#rbUsageType5").length > 0) {
                if (document.getElementById("rbUsageType5").checked == true)
                    usage = "10";
            }
        }

        var name = $("#iEstateName").val();             // 楼盘名称
        var buildlist = $("#hBuildList").val();         // 栋阁id列表
        var buildlevel = $("#hBuildLevel").val();       // 栋阁所属层级列表        
        var room = $("#sRoom").val();                   // 房
        var room1 = $("#sRoom1").val();                 // 房
        var hall = $("#sHall").val();                   // 厅
        var acreage1 = $("#iAcreage1").val();           // 面积
        var acreage2 = $("#iAcreage2").val();           // 面积
        var did = $("#sCity2").val();                   // 城区
        var aid = $("#sCity3").val();                   // 片区
        var status = $("#sStatus").val();               // 状态
        if (status == "") {
            status = 1;
        }
        var tradetype = $("#sTradeType").val();         // 交易 1出售 2出租 3租售
        var price1 = $("#iPrice1").val();               // 租售价
        var price2 = $("#iPrice2").val();               // 租售价

        var hasKey = 0;                                 // 0没钥匙 1有
        if ($("#cbHasKey").is(":checked"))
            hasKey = 1;

        var isOnly = 0;                                 // 0非独家 1独家
        if ($("#cbIsOnly").attr('checked'))
            isOnly = 1;
            
        var isCty = 0;                                  //是否反签
        if ($("#cbIsCty").attr('checked'))
            isCty = 1;
        
        var hasPhoto = 0;                               // 0无图片 1有图
        if ($("#cbHasPhoto").get(0).checked)
            hasPhoto = 1;

        var pocStatus = 0;                              // 0无红本 1有红本
        if ($("#cbPocStatus").get(0).checked)
            pocStatus = 1;

        var mark2 = 0;                                  // 0无满5年免税 1有满5年免税
        if ($("#cbMark2").get(0).checked)
            mark2 = 2;

        // 高级查询条件
        var id = $("#iID").val();                                   // 序号  
        var linkman = $("#iLinkMan").val();                         // 联系人
        var linktel = $("#iLinkTel").val();                         // 联系电话
        var unitPrice1 = $("#iUnitPrice1").val();                   // 单价1
        var unitPrice2 = $("#iUnitPrice2").val();                   // 单价2
        var markUdept = $("#utxdeptid").val();                      // 开盘人部门ID
        var adduser = $("#utxtsub").val();                          // 开盘人
        var fitment = LexunJS.GetSelectText("sFitment");            // 装修
        var houseStyle = LexunJS.GetSelectText("sHouseStyle");      // 样式
        var direct = LexunJS.GetSelectText("sDirect");              // 朝向
        var happliances = $("#iHappliances").val();                 // 房屋设施
        var type = LexunJS.GetSelectValue("sType");                 // 类型            
        var addDate1 = $("#iStartDay").val();                       // 委托日期
        var addDate2 = $("#iEndDay").val();                         // 委托日期
        var floor1 = $("#iFloor1").val();                           // 楼层1
        var floor2 = $("#iFloor2").val();                           // 楼层2
        var roomno = $("#iRoomNo").val();                           // 房号
        var infoFrom = LexunJS.GetSelectValue("infoFrom");          //来源
       

        var url = '../PM/HousingManager.aspx?usage=' + escape(usage) + '&name=' + escape(name) + '&buildlist=' + escape(buildlist) + '&buildlevel=' + escape(buildlevel)
                    + '&room=' + room + '&room1=' + room1 + '&hall=' + hall
                    + '&acreage1=' + acreage1 + '&acreage2=' + acreage2 + '&did=' + did + '&aid=' + aid + '&status=' + status + '&tradetype=' + tradetype
                    + '&price1=' + price1 + '&price2=' + price2 + '&hasKey=' + hasKey + '&isOnly=' + isOnly + '&hasPhoto=' + hasPhoto + '&pocStatus=' + pocStatus + '&mark2=' + mark2
                    + '&id=' + id + '&linkman=' + escape(linkman) + '&linktel=' + escape(linktel) + '&unitPrice1=' + unitPrice1 + '&unitPrice2=' + unitPrice2
                    + '&markUdept=' + escape(markUdept) + '&adduser=' + escape(adduser) + '&fitment=' + escape(fitment) + '&houseStyle=' + escape(houseStyle) + '&direct=' + escape(direct)
                    + '&happliances=' + happliances + '&addDate1=' + addDate1 + '&addDate2=' + addDate2 + '&type=' + escape(type) + '&floor1=' + floor1 + '&floor2=' + floor2
                    + '&roomno=' + roomno + '&isCty='+isCty+'&infoFrom='+escape(infoFrom);

        self.parent.closeTab('盘源列表');
        self.parent.addTab('盘源列表', url, 'icon-nav');
    }


    // 级联加载列表
    function loadCity(sCity1, sCity2) {
        var parentid = document.getElementById(sCity1).value;
        if (parentid <= 0)
            return false;

        $.ajax({
            type: 'POST',
            url: '../Handler/HandlerIndex.ashx',
            data: 'act=area_list&parentid=' + parentid,
            timeout: '10000',
            error: function() {
                alert("加载失败！");
            }, success: function(json) {
                loadCity2CallBack(json, sCity2);
            }
        });
    }

    // 加载城市列表回调
    function loadCity2CallBack(response, sCity2) {
        var json = eval("(" + response + ")");
        var record = json.record;

        $("#" + sCity2).html("");
        var obj = document.getElementById(sCity2);
        LexunJS.selectAddOption(obj, "全部", 0);

        if (record == null || record.length == 0)
            return;

        var recordLength = record.length;
        for (var i = 0; i < recordLength; i++) {
            var sName = record[i].name;
            var sValue = record[i].id;

            LexunJS.selectAddOption(obj, sName, sValue);
        }
    }

    // 切换交易类型
    function changeTradeType() {
        var id = LexunJS.GetSelectValue("sTradeType");

        if (id == 2)
            $("#spanTradeTypeUnit").text("元/月");
        else
            $("#spanTradeTypeUnit").text("万元");
    }

    // 重置
    function reset() {
        window.location.href = "";
    }

    // 加载数据
    function dataBind() {
        var usage = "";                 // 用途 1住宅 2商铺 3写字楼 4商住 5仓库 6厂房 7地皮 8项目盘 9其他* 10民房

        if ($("#rbUsageType1").length > 0) {
            if (document.getElementById("rbUsageType1").checked == true)
                usage = "1,4";
        }
        if ($("#rbUsageType2").length > 0) {
            if (document.getElementById("rbUsageType2").checked == true)
                usage = "3,4";
        }
        if ($("#rbUsageType3").length > 0) {
            if (document.getElementById("rbUsageType3").checked == true)
                usage = "2";
        }
        if ($("#rbUsageType4").length > 0) {
            if (document.getElementById("rbUsageType4").checked == true)
                usage = "6";
        }
        if ($("#rbUsageType5").length > 0) {
            if (document.getElementById("rbUsageType5").checked == true)
                usage = "10";
        }

        $("#hUsage").val(usage);
    }

</script>

</html>
